package cn.terminus.data.customer.settledenterpriseinfo.impl;

import cn.terminus.common.customer.bean.analysis.CustomerNatureIndustryNumResultDto;
import cn.terminus.common.customer.bean.analysis.SettledEnterpriseAnalysisDto;
import cn.terminus.common.customer.bean.analysis.SettledEnterpriseLabelNumResultDto;
import cn.terminus.common.customer.bean.settledenterpriseinfo.dto.*;
import cn.terminus.data.customer.settledenterpriseinfo.dao.SettledEnterpriseInfoDao;
import cn.terminus.data.customer.settledenterpriseinfo.mapper.SettledEnterpriseInfoMapper;
import cn.terminus.result.common.page.TerminusPageAble;
import cn.terminus.result.common.page.TerminusPageInfo;
import cn.terminus.result.common.util.BeanCopyUtils;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SettledEnterpriseInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-07-08 11:19:08
 */
@Repository
public class SettledEnterpriseInfoDaoImpl implements SettledEnterpriseInfoDao {
    @Resource
    private SettledEnterpriseInfoMapper settledEnterpriseInfoMapper;

    @Override
    public Integer add(SettledEnterpriseInfoNewDto dto) {
        return settledEnterpriseInfoMapper.add(dto);
    }

    @Override
    public Integer update(SettledEnterpriseInfoEditDto dto) {
        return settledEnterpriseInfoMapper.update(dto);
    }

    @Override
    public SettledEnterpriseInfoResultDto gets(SettledEnterpriseInfoGetsDto dto) {
        return settledEnterpriseInfoMapper.gets(dto);
    }

    @Override
    public List<SettledEnterpriseInfoResultDto> query(SettledEnterpriseInfoQueryDto dto) {
        return settledEnterpriseInfoMapper.query(dto);
    }

    @Override
    public Integer delete(SettledEnterpriseInfoDeleteDto dto) {
        return settledEnterpriseInfoMapper.delete(dto);
    }

    @Override
    public TerminusPageAble<SettledEnterpriseInfoResultDto> page(SettledEnterpriseInfoQueryDto dto, TerminusPageInfo page) {
        PageHelper.startPage(page.getCurrentPage(), page.getPageSize());
        Page<SettledEnterpriseInfoResultDto> result = (Page<SettledEnterpriseInfoResultDto>) settledEnterpriseInfoMapper.query(dto);
        return new TerminusPageAble<>(BeanCopyUtils.copy(result.getResult(), SettledEnterpriseInfoResultDto.class), page, result.getTotal());
    }

    @Override
    public Integer updateSettledStatus(Long id) {
        return settledEnterpriseInfoMapper.updateSettledStatus(id);
    }

    @Override
    public Integer updateSettledStatusToCustomer(List<Long> ids) {
        return settledEnterpriseInfoMapper.updateSettledStatusToCustomer(ids);
    }

    @Override
    public Integer updateStage(Long cboCustomerId) {
        return settledEnterpriseInfoMapper.updateStage(cboCustomerId);
    }

    @Override
    public List<CustomerNatureIndustryNumResultDto> analysisSettledEnterpriseNature(SettledEnterpriseAnalysisDto dto) {
        return settledEnterpriseInfoMapper.analysisSettledEnterpriseNature(dto);
    }

    @Override
    public List<CustomerNatureIndustryNumResultDto> analysisSettledEnterpriseIndustry(SettledEnterpriseAnalysisDto dto) {
        return settledEnterpriseInfoMapper.analysisSettledEnterpriseIndustry(dto);
    }

    @Override
    public List<SettledEnterpriseLabelNumResultDto> analysisSettledEnterpriseLabel(SettledEnterpriseAnalysisDto dto) {
        return settledEnterpriseInfoMapper.analysisSettledEnterpriseLabel(dto);
    }

}
